<?php
namespace App\Http\Controllers\Enterprise;
use App\Http\Controllers\BaseApiController;
use App\Model\Resume;
use App\Services\Enterprise\ResumeService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
class ResumeController extends BaseApiController{
    private $service;
    public function __construct(ResumeService $service){
        //继承基类的构造方法
        parent::__construct();
        //依赖注入service
        $this->service=$service;
    }
    /**
     * 简历管理  全部
     */
    public function ResumeLists(){
        $id=1;
        $arr=$this->service->ResumeLists($id);
        return $arr;
    }
    /**
     * 简历管理  带筛选
     */
    public function ResumeList(){
        $id=1;
        $arr=$this->service->ResumeList($id);
        return $arr;
    }
    /**
     * 简历管理 批量删除
     */
    public function ResumeDels(Request $request){
        //验证参数
        $rule=[
            'ids'=>'required|string',
            'connect'=>'required|string|max:100'
        ];
        if($error=$this->validate($rule,$request)){
            return $error;
        }
        //不合适的简历id
        $ids=$request->post('ids');
        //不合适的理由
        $connect=$request->post('connect');
        return $this->service->ResumeDel($ids,$connect);
    }
    /**
     * 简历管理  邀约面试
     */
    public function InviteAdd(Request $request){
        //验证参数
        $rule=[
            'ids'=>'required|string',
            'interview_model'=>'required|integer|max:3|min:1',
            'interview_mobile'=>'required|integer',
            'interview_site'=>'required|string',
            'interview_time'=>'required|date',
        ];
        if($error=$this->validate($rule,$request)){
            return $error;
        }
        $data=$request->post();
        return $this->service->InviteAdd($data);
    }
    /**
     * 简历列表  不合适
     */
    public function ResumeNolist(){
        $id=1;
        $arr=$this->service->ResumeNolist($id);
        return $arr;
    }
    /**
     * 查询所有该公司职位
     */
    public function PositionList(Request $request){
        $id=1;
        $result=$this->service->PositionList($id);
        return $result;
    }
    /**
     * 查询该公司中所有简历的学校
     */
    public function SchoolList(){
        $id=1;
        $result=$this->service->SchoolList($id);
        return $result;
    }
    /**
     * 查询该公司中所有简历的专业
     */
    public function MajorList(){
        $id=1;
        $result=$this->service->MajorList($id);
        return $result;
    }
}